home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / volume1a / form1.frm next >
Text File  |  1997-12-02  |  4KB  |  116 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Mixer API Test"
  4.    ClientHeight    =   1785
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   1785
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox Text2 
  13.       Height          =   375
  14.       Left            =   1320
  15.       TabIndex        =   3
  16.       Text            =   "0"
  17.       Top             =   840
  18.       Width           =   1335
  19.    End
  20.    Begin VB.TextBox Text1 
  21.       Height          =   375
  22.       Left            =   1320
  23.       TabIndex        =   2
  24.       Text            =   "0"
  25.       Top             =   120
  26.       Width           =   1335
  27.    End
  28.    Begin VB.CommandButton Command2 
  29.       Caption         =   "Mic Vol"
  30.       Height          =   375
  31.       Left            =   120
  32.       TabIndex        =   1
  33.       Top             =   840
  34.       Width           =   975
  35.    End
  36.    Begin VB.CommandButton Command1 
  37.       Caption         =   "Out Volume"
  38.       Height          =   375
  39.       Left            =   120
  40.       TabIndex        =   0
  41.       Top             =   120
  42.       Width           =   975
  43.    End
  44.    Begin VB.Label Label2 
  45.       Height          =   375
  46.       Left            =   2760
  47.       TabIndex        =   5
  48.       Top             =   840
  49.       Width           =   1815
  50.    End
  51.    Begin VB.Label Label1 
  52.       Height          =   375
  53.       Left            =   2760
  54.       TabIndex        =   4
  55.       Top             =   120
  56.       Width           =   1815
  57.    End
  58. End
  59. Attribute VB_Name = "Form1"
  60. Attribute VB_GlobalNameSpace = False
  61. Attribute VB_Creatable = False
  62. Attribute VB_PredeclaredId = True
  63. Attribute VB_Exposed = False
  64.       Option Explicit
  65.       
  66.       Dim hmixer As Long          ' mixer handle
  67.       Dim volCtrl As MIXERCONTROL ' waveout volume control
  68.       Dim micCtrl As MIXERCONTROL ' microphone volume control
  69.       Dim rc As Long              ' return code
  70.       Dim ok As Boolean           ' boolean return code
  71.       
  72.       Private Sub Form_Load()
  73.       ' Open the mixer with deviceID 0.
  74.          rc = mixerOpen(hmixer, 0, 0, 0, 0)
  75.          If ((MMSYSERR_NOERROR <> rc)) Then
  76.              MsgBox "Couldn't open the mixer."
  77.              Exit Sub
  78.              End If
  79.              
  80.          ' Get the waveout volume control
  81.          ok = GetVolumeControl(hmixer, _
  82.                               MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, _
  83.                               MIXERCONTROL_CONTROLTYPE_VOLUME, _
  84.                               volCtrl)
  85.          If (ok = True) Then
  86.              ' If the function successfully gets the volume control,
  87.              ' the maximum and minimum values are specified by
  88.              ' lMaximum and lMinimum
  89.              Label1.Caption = volCtrl.lMinimum _
  90.                               & " to " _
  91.                               & volCtrl.lMaximum
  92.              End If
  93.              
  94.          ' Get the microphone volume control
  95.          ok = GetVolumeControl(hmixer, _
  96.                               MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, _
  97.                               MIXERCONTROL_CONTROLTYPE_VOLUME, _
  98.                               micCtrl)
  99.          If (ok = True) Then
  100.              Label2.Caption = micCtrl.lMinimum _
  101.                               & " to " _
  102.                               & micCtrl.lMaximum
  103.              End If
  104.       End Sub
  105.       
  106.       Private Sub Command1_Click()
  107.          vol = CLng(Text1.Text)
  108.          SetVolumeControl hmixer, volCtrl, vol
  109.       End Sub
  110.       
  111.       Private Sub Command2_Click()
  112.          vol = CLng(Text2.Text)
  113.          SetVolumeControl hmixer, micCtrl, vol
  114.       End Sub
  115.       
  116.